package service

import (
	"context"
	"net/http"

	"configcenter/src/apimachinery/rest"
	"configcenter/src/common/errors"
	"configcenter/src/common/metadata"
)

// ServiceClientInterface TODO
type ServiceClientInterface interface {
	CreateServiceCategory(ctx context.Context, h http.Header, data map[string]interface{}) (resp *metadata.Response,
		err error)
	DeleteServiceCategory(ctx context.Context, h http.Header, data map[string]interface{}) (resp *metadata.Response,
		err error)
	SearchServiceCategory(ctx context.Context, h http.Header, opt *metadata.ListServiceCategoryOption) (
		*metadata.MultipleServiceCategory, errors.CCErrorCoder)
	UpdateServiceCategory(ctx context.Context, h http.Header, data map[string]interface{}) (resp *metadata.Response,
		err error)

	CreateServiceInstance(ctx context.Context, h http.Header, data *metadata.CreateServiceInstanceInput) ([]int64,
		errors.CCErrorCoder)
	UpdateServiceInstances(ctx context.Context, h http.Header, bizID int64, data map[string]interface{}) (
		resp *metadata.Response, err error)
	DeleteServiceInstance(ctx context.Context, h http.Header, data map[string]interface{}) (resp *metadata.Response,
		err error)
	SearchServiceInstance(ctx context.Context, h http.Header, data *metadata.GetServiceInstanceInModuleInput) (
		*metadata.MultipleServiceInstance, error)
	SearchServiceInstanceBySetTemplate(ctx context.Context, appID string, h http.Header,
		data map[string]interface{}) (resp *metadata.ResponseInstData, err error)
	ServiceInstanceAddLabels(ctx context.Context, h http.Header, data map[string]interface{}) (resp *metadata.Response,
		err error)
	ServiceInstanceRemoveLabels(ctx context.Context, h http.Header, data map[string]interface{}) (
		resp *metadata.Response, err error)
	ServiceInstanceFindLabels(ctx context.Context, h http.Header, data map[string]interface{}) (resp *metadata.Response,
		err error)

	CreateServiceTemplate(ctx context.Context, h http.Header, data map[string]interface{}) (
		resp *metadata.ResponseDataMapStr, err error)
	DeleteServiceTemplate(ctx context.Context, h http.Header,
		input *metadata.DeleteServiceTemplatesInput) errors.CCErrorCoder
	SearchServiceTemplate(ctx context.Context, h http.Header,
		data map[string]interface{}) (resp *metadata.ResponseDataMapStr, err error)
	FindServiceTemplateCountInfo(ctx context.Context, h http.Header, bizID int64,
		data map[string]interface{}) (resp *metadata.ArrayResponse, err error)
	UpdateServiceTemplate(ctx context.Context, h http.Header,
		data map[string]interface{}) (resp *metadata.ResponseDataMapStr, err error)
	RemoveTemplateBindingOnModule(ctx context.Context, h http.Header,
		data map[string]interface{}) (resp *metadata.ResponseDataMapStr, err error)
	CreateServiceTemplateAllInfo(ctx context.Context, h http.Header, opt *metadata.CreateSvcTempAllInfoOption) (int64,
		errors.CCErrorCoder)
	UpdateServiceTemplateAllInfo(ctx context.Context, h http.Header,
		opt *metadata.UpdateSvcTempAllInfoOption) errors.CCErrorCoder
	GetServiceTemplateAllInfo(ctx context.Context, h http.Header, opt *metadata.GetSvcTempAllInfoOption) (
		*metadata.SvcTempAllInfo, errors.CCErrorCoder)

	UpdateServiceTemplateAttribute(ctx context.Context, h http.Header,
		opt *metadata.UpdateServTempAttrOption) errors.CCErrorCoder
	DeleteServiceTemplateAttribute(ctx context.Context, h http.Header,
		opt *metadata.DeleteServTempAttrOption) errors.CCErrorCoder
	ListServiceTemplateAttribute(ctx context.Context, h http.Header, opt *metadata.ListServTempAttrOption) (
		*metadata.ServTempAttrData, errors.CCErrorCoder)

	DiffServiceTemplateGeneral(ctx context.Context, h http.Header, opt *metadata.ServiceTemplateDiffOption) (
		*metadata.ServiceTemplateGeneralDiff, errors.CCErrorCoder)
	SyncServiceInstanceByTemplate(ctx context.Context, h http.Header,
		opt *metadata.SyncServiceInstanceByTemplateOption) errors.CCErrorCoder
}

// NewServiceClientInterface TODO
func NewServiceClientInterface(client rest.ClientInterface) ServiceClientInterface {
	return &service{client: client}
}

type service struct {
	client rest.ClientInterface
}
